package com.lyj.sc.dynamicProgramming.test20220728;

/**
 * @program: code-random
 * @description:
 * @author: lyj
 * @create: 2022-07-28 11:43
 * @version: 1.0
 * @Modifier By:
 **/
public class Solution {
    public int findMaxForm(String[] strs, int m, int n) {
        //使用01背包
        //1定义dp数组
        int[][] dp = new int[m+1][n+1];
        //遍历循环
        for (int i = 0; i < strs.length; i++) {
            int onenum=0;
            int zeronum=0;
            for (int i1 = 0; i1 < strs[i].length(); i1++) {
                if(strs[i].charAt(i1)=='0'){
                    zeronum++;
                }else {
                    onenum++;
                }
            }
            //倒叙排列
            for (int j = m; j >=zeronum; j--) {
                for (int k = n; k >=onenum; k--) {
                    dp[j][k]=Math.max(dp[j][k],dp[j-zeronum][k-onenum]+1);
                }
            }
        }
        return dp[m][n];
    }

    public static void main(String[] args) {
        String a="123";
        String ab="123";
        System.out.println(a==ab);
    }
}
